package org.xiji.iterator;

/**
 * 迭代器测试类
 */
public class IteratorMain {

    public static void main(String[] args) {
        MyList<String> stringMyList = new MyList<>();
        //字符串迭代器类
        stringMyList.add("张三");
        stringMyList.add("李四");
        stringMyList.add("王五");
        while (stringMyList.hasNext()) {
            System.out.println(stringMyList.next());
        }
        System.out.println("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ");
        stringMyList.remove();
        while (stringMyList.hasNext()) {
            System.out.println(stringMyList.next());
        }
        System.out.println("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ");
        stringMyList.add("小久");
        while (stringMyList.hasNext()) {
            System.out.println(stringMyList.next());
        }
        System.out.println("------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"
        );
        stringMyList.remove(1);
        while (stringMyList.hasNext()) {
            System.out.println(stringMyList.next());
        }
    }
}
